package fr.afcepf.atod18.client.dao;


import javax.activation.DataSource;

import fr.afcepf.atod18.client.entity.Remise;
import fr.afcepf.atod18.client.idao.IDaoRemise;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class DaoRemise extends HibernateDaoSupport  implements IDaoRemise  {
	
	private DataSource datasource;
	private String libelleRemiseSuppr;
	private Remise r;

	public DataSource getDatasource() {
		return datasource;
	}

	public void setDatasource(DataSource datasource) {
		this.datasource = datasource;
	}

	public String getLibelleRemiseSuppr() {
		return libelleRemiseSuppr;
	}

	public void setLibelleRemiseSuppr(String libelleRemiseSuppr) {
		this.libelleRemiseSuppr = libelleRemiseSuppr;
	}

	public Remise getR() {
		return r;
	}

	public void setR(Remise r) {
		this.r = r;
	}

	@Override
	public void creerRemise(Remise r) {
		
		getHibernateTemplate().save(r);

	}

	@Override
	public void modifierRemise(Remise r) {
		getHibernateTemplate().update(r);

	}

	@Override
	public void supprimerRemise(String libelleRemiseSuppr) {
		
		r = (Remise) getHibernateTemplate().find(libelleRemiseSuppr);
		getHibernateTemplate().delete(r);
 
		}
}
